//
//  RTJDebtCalendarCell.m
//  RuiTaiJinProject
//
//  Created by jayson on 2019/3/27.
//  Copyright © 2019年 leewei. All rights reserved.
//

#import "RTJDebtCalendarCell.h"
#import "LXCalender.h"

#define LL_SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
#define LL_SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)
#define Iphone6Scale(x) ((x) * LL_SCREEN_WIDTH / 375.0f)

#define HeaderViewHeight 30
#define WeekViewHeight 40

@interface RTJDebtCalendarCell ()

//@property (strong, nonatomic) UICollectionView *collectionViews;
//@property (weak, nonatomic) IBOutlet UIView *bg_view;

@property (nonatomic, nonatomic)  LXCalendarView *calenderView;
@property (weak, nonatomic) IBOutlet UIView *bg_view;


@property (weak, nonatomic) IBOutlet UILabel *lab1;
@property (weak, nonatomic) IBOutlet UILabel *lab2;
@property (weak, nonatomic) IBOutlet UILabel *lab3;
@property (weak, nonatomic) IBOutlet UILabel *lab4;


@property (strong, nonatomic) NSDate *tempDate;

@end

@implementation RTJDebtCalendarCell

- (void)awakeFromNib {
    [super awakeFromNib];


    self.backgroundColor =[UIColor whiteColor];
    
    self.calenderView =[[LXCalendarView alloc]initWithFrame:CGRectMake(0, 0, screenW, self.bg_view.height)];

    [self.bg_view addSubview:self.calenderView];
    
    self.calenderView.currentMonthTitleColor =[UIColor colorForHex:@"333333"];
    self.calenderView.lastMonthTitleColor =[UIColor colorForHex:@"333333"];
    self.calenderView.nextMonthTitleColor =[UIColor colorForHex:@"333333"];
    
    self.calenderView.isHaveAnimation = YES;
    
    self.calenderView.isCanScroll = YES;
    self.calenderView.isShowLastAndNextBtn = YES;
    
    self.calenderView.todayTitleColor =[UIColor colorForHex:@"333333"];
    self.calenderView.selectBackColor =[UIColor colorForHex:@"#31C7FF"];
    self.calenderView.isShowLastAndNextDate = NO;
    self.calenderView.backgroundColor =[UIColor clearColor];
 
}


-(void)setData:(NSDictionary *)data{
    
    if (_data!= data) {
        
        _data = data;
    }
    
    self.calenderView.data = _data[@"deal_repay"];
    [self.calenderView dealData];

    __weak typeof(self) weakSelf = self;
    self.calenderView.selectBlock = ^(NSInteger year, NSInteger month, NSInteger day) {
        NSLog(@"%ld年 - %ld月 - %ld日",year,month,day);
        
         [weakSelf.delegate selectedCurrentDay:[NSString stringWithFormat:@"%ld-%02ld-%02ld",(long)year,(long)month,(long)day] isUpdate:YES];
    };

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
